import { RouterMenu } from "@/api/service/menu/types";
import { defineStore } from "pinia";
interface ISystem {
  tableConfig: TableConfig;
  language: Language;
  baseUrl: string;
  routerList: RouterMenu[];
}

interface Language {
  message?: any;
  local: string;
  version: string;
}

interface TableConfig {
  stripe: boolean;
  bordered: boolean;
  hoverable: boolean;
  tableLayoutFixed: boolean;
  showHeader: boolean;
  columnResizable: boolean;
  stickyHeader: boolean;
}

export const getTableConfig = () => {
  return systemStore().$state.tableConfig;
};

export const systemStore = defineStore("system", {
  state: (): ISystem => {
    return {
      tableConfig: {
        stripe: true,
        bordered: true,
        hoverable: true,
        tableLayoutFixed: false,
        showHeader: true,
        columnResizable: true,
        stickyHeader: true
      },
      language: {
        message: undefined,
        local: "",
        version: ""
      },
      baseUrl: "",
      routerList: []
    };
  },
  persist: true
});
